<?php
/**
 * Created by PhpStorm.
 * User: C。
 * Date: 2019/8/13
 * Time: 9:04
 */
namespace app\home\controller;

use app\common\model\CompanyHuanyuan as CompanyHuanyuanModel;
use app\common\model\CompanyGongdengOrder as CompanyGongdengOrderModel;

/**
 * 寺院还愿控制器
 * Class Companyhuanyuan
 * @package app\home\controller
 */
class Companyhuanyuan extends Base
{
    protected $moren = [
        'foxiang' =>array(
            [
                'name' => '释迦摩尼佛',
                'img' => 'https://fushan.oss-cn-hangzhou.aliyuncs.com/%E6%99%BA%E6%85%A7%E5%AF%BA%E9%99%A2/%E4%BD%9B%E5%83%8F/1-%E9%87%8A%E4%BC%BD%E7%89%9F%E5%B0%BC%E4%BD%9B.png',
            ],[
                'name' => '阿弥陀佛',
                'img' => 'https://fushan.oss-cn-hangzhou.aliyuncs.com/%E6%99%BA%E6%85%A7%E5%AF%BA%E9%99%A2/%E4%BD%9B%E5%83%8F/2-%E9%98%BF%E5%BC%A5%E9%99%80%E4%BD%9B.png',
            ],[
                'name' => '药师佛',
                'img' => 'https://fushan.oss-cn-hangzhou.aliyuncs.com/%E6%99%BA%E6%85%A7%E5%AF%BA%E9%99%A2/%E4%BD%9B%E5%83%8F/3-%E8%8D%AF%E5%B8%88%E4%BD%9B.png',
            ],[
                'name' => '弥勒佛',
                'img' => 'https://fushan.oss-cn-hangzhou.aliyuncs.com/%E6%99%BA%E6%85%A7%E5%AF%BA%E9%99%A2/%E4%BD%9B%E5%83%8F/4-%E5%BC%A5%E5%8B%92%E4%BD%9B.png',
            ],[
                'name' => '大势至菩萨',
                'img' => 'https://fushan.oss-cn-hangzhou.aliyuncs.com/%E6%99%BA%E6%85%A7%E5%AF%BA%E9%99%A2/%E4%BD%9B%E5%83%8F/5-%E5%A4%A7%E5%8A%BF%E8%87%B3%E8%8F%A9%E8%90%A8.png',
            ],[
                'name' => '观音菩萨',
                'img' => 'https://fushan.oss-cn-hangzhou.aliyuncs.com/%E6%99%BA%E6%85%A7%E5%AF%BA%E9%99%A2/%E4%BD%9B%E5%83%8F/6-%E8%A7%82%E9%9F%B3%E8%8F%A9%E8%90%A8.png',
            ],[
                'name' => '地藏菩萨',
                'img' => 'https://fushan.oss-cn-hangzhou.aliyuncs.com/%E6%99%BA%E6%85%A7%E5%AF%BA%E9%99%A2/%E4%BD%9B%E5%83%8F/7-%E5%9C%B0%E8%97%8F%E8%8F%A9%E8%90%A8.png',
            ]
        ),
        'gonghua' =>array(
            [
                'name' => '吉祥花',
                'img' => [
                    'https://fushan.oss-cn-hangzhou.aliyuncs.com/%E6%99%BA%E6%85%A7%E5%AF%BA%E9%99%A2/%E4%BE%9B%E8%8A%B1/%E5%90%89%E7%A5%A5.png',
                    'https://fushan.oss-cn-hangzhou.aliyuncs.com/%E6%99%BA%E6%85%A7%E5%AF%BA%E9%99%A2/%E4%BE%9B%E8%8A%B1/%E5%90%89%E7%A5%A5%E8%8A%B1.png'
                ],
                'price'=> '1'
            ],[
                'name' => '如意花',
                'img' => [
                    'https://fushan.oss-cn-hangzhou.aliyuncs.com/%E6%99%BA%E6%85%A7%E5%AF%BA%E9%99%A2/%E4%BE%9B%E8%8A%B1/%E5%A6%82%E6%84%8F.png',
                    'https://fushan.oss-cn-hangzhou.aliyuncs.com/%E6%99%BA%E6%85%A7%E5%AF%BA%E9%99%A2/%E4%BE%9B%E8%8A%B1/%E5%A6%82%E6%84%8F%E8%8A%B1.png'
                ],
                'price'=> '3'
            ],[
                'name' => '平安花',
                'img' => [
                    'https://fushan.oss-cn-hangzhou.aliyuncs.com/%E6%99%BA%E6%85%A7%E5%AF%BA%E9%99%A2/%E4%BE%9B%E8%8A%B1/%E5%B9%B3%E5%AE%89.png',
                    'https://fushan.oss-cn-hangzhou.aliyuncs.com/%E6%99%BA%E6%85%A7%E5%AF%BA%E9%99%A2/%E4%BE%9B%E8%8A%B1/%E5%B9%B3%E5%AE%89%E8%8A%B1.png'
                ],
                'price'=> '6'
            ]
        ),
        'gongguo' =>array(
            [
                'name' => '平安果',
                'img' => [
                    'https://fushan.oss-cn-hangzhou.aliyuncs.com/%E6%99%BA%E6%85%A7%E5%AF%BA%E9%99%A2/%E4%BE%9B%E6%9E%9C/%E5%B9%B3%E5%AE%89.png',
                    'https://fushan.oss-cn-hangzhou.aliyuncs.com/%E6%99%BA%E6%85%A7%E5%AF%BA%E9%99%A2/%E4%BE%9B%E6%9E%9C/%E5%B9%B3%E5%AE%89%E6%9E%9C.png'
                ],
                'price'=> '1'
            ],[
                'name' => '财运果',
                'img' => [
                    'https://fushan.oss-cn-hangzhou.aliyuncs.com/%E6%99%BA%E6%85%A7%E5%AF%BA%E9%99%A2/%E4%BE%9B%E6%9E%9C/%E8%B4%A2%E8%BF%90.png',
                    'https://fushan.oss-cn-hangzhou.aliyuncs.com/%E6%99%BA%E6%85%A7%E5%AF%BA%E9%99%A2/%E4%BE%9B%E6%9E%9C/%E8%B4%A2%E8%BF%90%E6%9E%9C.png'
                ],
                'price'=> '3'
            ],[
                'name' => '长寿果',
                'img' => [
                    'https://fushan.oss-cn-hangzhou.aliyuncs.com/%E6%99%BA%E6%85%A7%E5%AF%BA%E9%99%A2/%E4%BE%9B%E6%9E%9C/%E9%95%BF%E5%AF%BF.png',
                    'https://fushan.oss-cn-hangzhou.aliyuncs.com/%E6%99%BA%E6%85%A7%E5%AF%BA%E9%99%A2/%E4%BE%9B%E6%9E%9C/%E9%95%BF%E5%AF%BF%E6%9E%9C.png'
                ],
                'price'=> '6'
            ]
        )
    ];
    /**
     * [getprice  获取价格]
     * @param
     * @author [C。]
     * @return json
     */
    public function getconfig()
    {
        $param = input('param.');
        $model = new CompanyHuanyuanModel;
        try{
            $config = $model->findData($param['id'],'comid','foxiang,gonghua,gongguo');
            if(empty($config)){
                $config = $this->moren;
            }else{
                $config['foxiang'] = unserialize($config['foxiang']);
                $config['gonghua'] = unserialize($config['gonghua']);
                $config['gongguo'] = unserialize($config['gongguo']);
            }
        } catch (\Exception $e) {
            systembug($e->getMessage(),2,$this->url);
            return admin_json(-1, '获取失败' . $e->getMessage());
        }
        return admin_json(1, '获取成功',$config);
    }
}